#include <iostream>
#include <cmath>
#include<algorithm>
#include<cstring>

using namespace std;

class Binarysearch{
private:
    float a_0;
    float b_0;
    int M;
    float er;
public:
    float fun(float x);
    Binarysearch(float a,float b,int c,float e){
        a_0=a;
        b_0=b;
        M=c;
        er=e;
    }
    float search(){
        float c;
        for (int i=0;i<M;i++){
        c=(a_0+b_0)/2;
        if (abs(fun(c))<er){
            return c;
        }
        if (fun(a_0)*fun(c)<0){
            b_0=c;
        }
        else{a_0=c;}
        }
        return c;
        }
};
float Binarysearch::fun(float x){
    //return 1/x-tan(x);//前四个函数为B中四个函数，第五个为E中对应函数
    //return 1/x-pow(2,x);
    //return pow(2,-x)+exp(x)+2*cos(x)-6;
    //return (pow(x,3)+4*pow(x,2)+3*x+5)/(2*pow(x,3)-9*pow(x,2)+18*x-2);
    return 3.307-10*asin(x)-10*x*sqrt(1-x*x);
}

class Newtonsearch{
private:
    float x_0;
    int M;
    float er;
public:
    float fun(float x);
    float fun1(float x);
    Newtonsearch(float a,int m,float e){
        x_0=a;
        er=e;
        M=m;
    }
    float search(){
        float x;
        x=x_0-fun(x_0)/fun1(x_0);
        for(int i=0;i<M;i++){
            if(abs(fun(x))<er){
                return x;
            }
            x=x-fun(x)/fun1(x);
        }
        return x;
    }
};
float Newtonsearch::fun(float x){
    //return x-tan(x);//第一个函数对应C中函数，第二个函数是E中函数,第三个为F中函数
    //return 3.307-10*asin(x)-10*x*sqrt(1-x*x);
    //return 17.74*sin(x)*cos(x)+87.21*pow(sin(x),2)-9.66*cos(x)-47.46*sin(x);//F(a)
    return 17.74*sin(x)*cos(x)+87.21*pow(sin(x),2)-9.71*cos(x)-47.71*sin(x);//F(b)
}
float Newtonsearch::fun1(float x){
    //return 1-1/pow(cos(x),2);//同上
    //return -10/sqrt(1-x*x)-10*sqrt(1-x*x)+10*x*x/sqrt(1-x*x);
    //return 17.74*cos(2*x)+87.21*sin(2*x)+9.66*sin(x)-47.46*cos(x);//F(a)
    return 17.74*cos(2*x)+87.21*sin(2*x)+9.71*sin(x)-47.71*cos(x);//F(b)
}


class Secantsearch{
private:
    float x_0,x_1;
    int M;
    float er;
public:
    float fun(float x);
    Secantsearch(float a,float b,int m,float e){
        x_0=a;
        x_1=b;
        M=m;
        er=e;
    }
    float search(){
        float x_n,x_m;
        x_n=x_1-(x_1-x_0)*fun(x_0)/(fun(x_1)-fun(x_0));
        x_m=x_1;
        for(int i=0;i<M;i++){
            if(abs(fun(x_n))<er){
                return x_n;
            }
            float x=x_n;
            x_n=x_n-(x_n-x_m)*fun(x_n)/(fun(x_n)-fun(x_m));
            x_m=x;
        }
        return x_n;
    }

};
float Secantsearch::fun(float x){
    //return sin(x/2)-1;
    //return 3.307-10*asin(x)-10*x*sqrt(1-x*x);//E
    return 17.74*cos(2*x)+87.21*sin(2*x)+9.66*sin(x)-47.46*cos(x);
}